package com.nvelickovic10.snake.main;

import javax.swing.JOptionPane;

import com.nvelickovic10.snake.beans.engine.Engine;
import com.nvelickovic10.snake.beans.game.GameSave;

public class Application {

	public static void main(String[] args) {
		AppCore.getInstance();
		Engine engine = new Engine();
		AppCore.getInstance().setEngine(engine);
		String username = JOptionPane.showInputDialog(null, "WELCOME!",
				"SNAKE nvelickovic10", JOptionPane.DEFAULT_OPTION);
		if (username != null && username.trim().length() > 0) {
			username = username.trim();
			AppCore.getInstance().setUsername(username);
		}
		int resp = JOptionPane.showConfirmDialog(null, "LOAD GAME?",
				"SNAKE nvelickovic10", JOptionPane.YES_NO_OPTION);
		if (resp == JOptionPane.YES_OPTION) {
			GameSave gs = new GameSave();
			gs.load();
		}
		engine.start();
	}
}
